/**
 * @RpcHttpServer.java  COPYRIGHT xiaojian
 * 
 * Created on 2017年1月5日 下午4:24:32
 */
package xj.toolkit.rpc.core;


import org.springframework.beans.factory.annotation.Autowired;

import xj.toolkit.netty.server.HttpServer;
import xj.toolkit.rpc.naming.RpcNode;
import xj.toolkit.rpc.naming.RpcServerNamingService;

/**
 * @author <a href="mailto:cxj2000@gmail.com">xiaojian.cao</a>
 *
 */
public class RpcHttpServer extends HttpServer {

	@Autowired
	private RpcServerNamingService namingService = null;

	public void start() throws Exception {
		super.start();
		
		RpcNode node = new RpcNode();
		node.setIpAddress(super.getAcceptIp());
		node.setPort(super.getAcceptPort());
		namingService.registerNode(node);
	}
	
	
	
	public void stop() {
		super.stop();
		
		namingService.unRegisterNode();
	}

}
